﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.DigitalTwinAlignment.CCoDigitalTwinAlignmentExportCmd
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using Microsoft.Win32;
using System.Windows.Input;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.DigitalTwinAlignment;

public class CCoDigitalTwinAlignmentExportCmd : TxButtonCommand
{
  private readonly CApEnabler _enabler = new CApEnabler();

  public virtual string Description => DnProcessSimulateCommands.DigitalTwinAlignment.Resources.Resources.ExportCommandDescription;

  public virtual string Category => DnProcessSimulateCommands.DigitalTwinAlignment.Resources.Resources.CommandCategory;

  public virtual string Name => DnProcessSimulateCommands.DigitalTwinAlignment.Resources.Resources.ExportCommandName;

  public virtual string Tooltip => DnProcessSimulateCommands.DigitalTwinAlignment.Resources.Resources.ExportCommandTooltip;

  public virtual string Bitmap => "DigitalTwinAlignment.Resources.DTA_EXPORT.bmp";

  public virtual string LargeBitmap => "DigitalTwinAlignment.Resources.DTA_EXPORT_LARGE.png";

  public virtual bool Licensed => TxCommandLicenser.DigitalTwinAlignmentLicense;

  public virtual ITxCommandEnabler CommandEnabler => (ITxCommandEnabler) this._enabler;

  public virtual ITxImage Image => (ITxImage) TxImageManager.GetImageByKey("ExportArScene");

  public virtual void Execute(object cmdParams)
  {
    SaveFileDialog saveFileDialog1 = new SaveFileDialog();
    saveFileDialog1.Filter = "PLMX file|*.plmx";
    saveFileDialog1.Title = DnProcessSimulateCommands.DigitalTwinAlignment.Resources.Resources.ExportFileDialogTitle;
    SaveFileDialog saveFileDialog2 = saveFileDialog1;
    bool? nullable = saveFileDialog2.ShowDialog();
    bool flag = true;
    if (!(nullable.GetValueOrDefault() == flag & nullable.HasValue))
      return;
    try
    {
      Mouse.OverrideCursor = Cursors.Wait;
      Mouse.UpdateCursor();
      CApDataManipulator.ExportModel(saveFileDialog2.FileName);
    }
    finally
    {
      Mouse.OverrideCursor = (Cursor) null;
      Mouse.UpdateCursor();
    }
  }
}
